home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / Think C dcmd 1.0.1 ƒ / Think Put Lib source / PutSDec.c < prev    next >
Encoding:
Text File  |  1994-06-12  |  386 b   |  22 lines  |  [TEXT/KAHL]

  1. void PutChar(char c);
  2. void PutText(const char* s, int len );
  3. void __DecToText (unsigned long dec, char* str );
  4.  
  5. void PutSDec(signed long i)
  6. {
  7.         Boolean     isNeg;
  8.         int         n = 0;
  9.         char*     str = "0000000000";
  10.     
  11.     if ( isNeg = ( i < 0 ) )
  12.         i = -i;
  13.     
  14.     __DecToText (i, str );
  15.     
  16.     while ( str[n] == '0' && n<9 )
  17.         n++;
  18.     
  19.     PutChar( '#' );
  20.     if ( isNeg ) PutChar( '-' );
  21.     PutText( &str[n], 10-n );
  22. }